Use sprintf return value instead of invoking strlen on result.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 26 Jun 2012 02:33:51 +0000 (19:33 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 26 Jun 2012 02:33:51 +0000 (19:33 -0700)
commit192041ed96b98844673dd5327d1fd66296627727
tree125b499954e535019ff1704ee7a3f3b70f270578
parenta2ac3e1c27f8f0da6b4378d0704217233d6f44e5
Use sprintf return value instead of invoking strlen on result.

In the old days this wasn't portable, since some sprintf
implementations returned char *.  But they died out years ago and
Emacs already assumes sprintf returns int.
Similarly for float_to_string.
This patch speeds up (number-to-string 1000) by 3% on Fedora 15 x86-64.
* ccl.c (ccl_driver):
* character.c (string_escape_byte8):
* data.c (Fnumber_to_string):
* doprnt.c (doprnt):
* print.c (print_object):
* xdisp.c (message_dolog):
* xfns.c (syms_of_xfns):
Use sprintf or float_to_string result to avoid need to call strlen.
* data.c (Fnumber_to_string):
Use make_unibyte_string, since the string must be ASCII.
* lisp.h, print.c (float_to_string): Now returns int length.
* term.c (produce_glyphless_glyph):
Use sprintf result rather than recomputing it.
src/ChangeLog
src/ccl.c
src/character.c
src/data.c
src/doprnt.c
src/lisp.h
src/print.c
src/term.c
src/xdisp.c
src/xfns.c